'use strict';

module.exports = app => {
  const { STRING, UUID, UUIDV4 } = app.Sequelize;

  const model = app.model.define('repair_workflow', {
    id: {
      type: UUID,
      primaryKey: true,
      defaultValue: UUIDV4,
      comment: '主键',
    },
    workflow_id: {
      type: UUID,
      allowNull: false,
      comment: '流程对应数据Id',
    },
    from_userid: {
      type: UUID,
      comment: '流程发起人用户Id',
    },
    from_username: {
      type: STRING,
      allowNull: false,
      comment: '流程发起人用户名',
    },
    to_userid: {
      type: UUID,
      comment: '流程处理人用户Id',
    },
    to_username: {
      type: STRING,
      comment: '流程处理人用户名',
    },
    step: {
      type: STRING,
      comment: '步骤名称',
    },
    remark: {
      type: STRING,
      comment: '备注',
    },
    files: {
      type: STRING,
      comment: '流程附件',
    },
  }, {
      tableName: 'repair_workflow',
      comment: '报修记录表',
    });

  return model;
};
